#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2019/11/20 08:58|08:58
# @Author  : yangdingyi
# @File    : 数组拆分 I
# @Software: PyCharm

from typing import List


class Solution:
    def arrayPairSum(self, nums: List[int]) -> int:
        """
        数组拆分
        思路：从小到大，两两一组，双指针？？？
        :param nums:
        :return:
        """
        ans = 0
        n = len(nums)
        nums.sort()
        for i in range(0, n, 2):
            ans += nums[i]
        return ans


solve = Solution()

nums = [1, 4, 3, 2]
print(nums)
ans = solve.arrayPairSum(nums)
print(ans)
